<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>我的招标</title>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>

</head>
<body>
<div class="layui-container">
    <table id="table1" lay-filter="test"></table>
</div>
</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="select">挑选</a>
    <!--    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
</script>

<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['table','util'], function () {
        var table = layui.table,
            $ = layui.$,
            util = layui.util;

        //第一个实例
        table.render({
            elem: '#table1'
            , height: 312
            , url: '/get' //数据接口
            , page: true //开启分页
            , cols: [
                [ //表头
                    {field: 'projectId', title: '项目编号', fixed: 'left'}
                    , {field: 'title', title: '项目名称' }
                    , {field: 'openTime', title: '开标时间', templet : function(d){
                        return util.toDateString(d.openTime,'yyyy-MM-dd HH:mm:ss');
                    }}
                    , {fixed: 'right', title: '操作', width: 65, toolbar: '#barDemo'}
                ]
            ]
        });

        //监听工具条
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            if (obj.event === 'select') {
                location.href='/expertSelectJump/'+data.id;
            }
        });

    });
</script>
</html>